﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Logoned.Master" Inherits="System.Web.Mvc.ViewPage<CourseSystem.Core.Entities.ExaminationSummaryInfo>" %>

<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    练习答案
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <% Html.RenderPartial("TopUc"); %>
        <% Html.RenderPartial("NavUc", 3); %>
        <% Html.RenderPartial("ExamLibNavUc", 1); %>
    </table>
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td height="200" align="center" valign="top" class="contentBackImg">
                <table width="950" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="28" align="left" background="<%=ResolveUrl("~/Content/images/5_01_1.gif")%>">
                            <table width="343" height="28" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="18">
                                    </td>
                                    <td width="325">
                                        <div align="left" class="style18">
                                            <strong><span class="style48">位置：</span></strong><span class="style11">作业测验-练习答案
                                            </span>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" valign="top" background="<%=ResolveUrl("~/Content/images/5_02_1.gif")%>">
                            <table width="944" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="center" valign="top" bgcolor="#FFFFFF">
                                        <table width="50%" height="2" border="0" align="center" cellpadding="0" cellspacing="0"
                                            bordercolor="#FFFFFF">
                                            <tr>
                                                <td bgcolor="#FFFFFF">
                                                </td>
                                            </tr>
                                        </table>
                                        <div align="left">
                                        </div>
                                        <table width="944" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td align="center" valign="top">
                                                    <table width="600" height="" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td>
                                                                <div align="center">
                                                                    <h2>
                                                                        你的总分:<%=Model.Score %></h2>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <%
                                                        var examInfo = Model.ExaminationInfo;
                                                        if (examInfo == null)
                                                        { %>
                                                    空.
                                                    <%}
        else
        {
            var currentTitleId = 1;
            var needWash = examInfo.QuestionType == 1 || examInfo.QuestionType == 3;
            var needAnsWash = examInfo.QuestionType == 2 || examInfo.QuestionType == 3;
            var stuKeyList = examInfo.ExamAnswerInfo.Where(o => o.Uid == UserHelper.LoginUser.Id).ToList();
            var type0Model =
                examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 0).ToList();
            var type0Count = type0Model.Count;
            var type1Model =
                examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 1).ToList();
            var type1Count = type1Model.Count;
            var type2Model =
               examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 2).ToList();
            var type2Count = type2Model.Count;
            var type3Model =
               examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 3).ToList();
            var type3Count = type3Model.Count;
            var type4Model =
               examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 4).ToList();
            var type4Count = type4Model.Count; 
                                                    %>
                                                    <% if (type0Count != 0)
                                                       {
                                                           var i = 1; %>
                                                    <table width="748" height="30" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td height="30" class="style31">
                                                                <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>单项选择题</strong>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <table width="650" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td valign="top">
                                                                <div align="left" class="style1">
                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                        <%
           var type0OrderList = ExamLibHelper.GetOrderList(examInfo.Id, 0, UserHelper.LoginUser.Id,
                                                           type0Model.Count, needWash);

           for (int ii = 0; ii < type0OrderList.Count; ii++)
           {
               var item = type0Model[type0OrderList[ii]];
               var keyInfo =
                    stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);%>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <span class="style53">[<%=ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, examInfo.Score)%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                                                                            </td>
                                                                        </tr>
                                                                        <%
               var type0AnsOrder = ExamLibHelper.GetRanList(item.QuestionLibInfo.RadioChoicesInfo.Count, needAnsWash);

               for (int j = 0; j < type0AnsOrder.Count; j++)
               {
                   var info = item.QuestionLibInfo.RadioChoicesInfo[type0AnsOrder[j]];
                                                                        %>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <%=
                                                           Html.RadioButton("radio" + item.QuestionLibInfo.Id, info.Id,
                                                                            keyInfo != null &&
                                                                            keyInfo.AnswerId == info.Id,
                                                                            new {id = "radio" + info.Id}) %>
                                                                                <%-- <input type="radio" name="radio<%=item.QuestionLibInfo.RadioChoicesInfo[j].Id %>" value="<%=item.QuestionLibInfo.RadioChoicesInfo[j] %>"/>--%>
                                                                                <label for="radio<%= info.Id %>">
                                                                                    <%= RadioChoicesHelper.GetChoiceLetter(j) %>.<%= info.Title %></label>
                                                                                <% if (info.IsAnswer)
                                                                                   { %><span class="style53">[答案]</span><% } %>
                                                                            </td>
                                                                        </tr>
                                                                        <% } %>
                                                                        <% } %>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <% } %>
                                                    <% if (type1Count != 0)
                                                       {
                                                           var i = 1; %>
                                                    <table width="748" height="30" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td height="30" class="style31">
                                                                <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>多项选择题</strong>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <table width="650" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td valign="top">
                                                                <div align="left" class="style1">
                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                        <% var type1OrderList = ExamLibHelper.GetOrderList(examInfo.Id, 1, UserHelper.LoginUser.Id,
                                                       type1Model.Count, needWash);

                                                                           for (int ii = 0; ii < type1OrderList.Count; ii++)
                                                                           {
                                                                               var item = type1Model[type1OrderList[ii]];
                                                                               var keyInfo =
                                                                                   stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);%>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <span class="style53">[<%=ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, examInfo.Score)%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                                                                            </td>
                                                                        </tr>
                                                                        <%
                               var type1AnsOrder = ExamLibHelper.GetRanList(item.QuestionLibInfo.RadioChoicesInfo.Count, needAnsWash);
                               for (int j = 0; j < type1AnsOrder.Count; j++)
                               {
                                   var info = item.QuestionLibInfo.RadioChoicesInfo[type1AnsOrder[j]];
                        
                                                                        %>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <%= Html.CheckBox("check" + info.Id,
                                                                                        keyInfo != null &&
                                                                                        (","+keyInfo.Answer+",").Contains(","+info.Id+","),
                                                                                        new {id = "check" + info.Id}) %>
                                                                                <%-- <input type="radio" name="radio<%=item.QuestionLibInfo.RadioChoicesInfo[j].Id %>" value="<%=item.QuestionLibInfo.RadioChoicesInfo[j] %>"/>--%>
                                                                                <label for="check<%= info.Id %>">
                                                                                    <%= RadioChoicesHelper.GetChoiceLetter(j) %>.<%= info.Title %></label>
                                                                                <% if (info.IsAnswer)
                                                                                   { %><span class="style53">[答案]</span><% } %>
                                                                            </td>
                                                                        </tr>
                                                                        <% } %>
                                                                        <% } %>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <% } %>
                                                    <% if (type2Count != 0)
                                                       {
                                                           var i = 1; %>
                                                    <table width="748" height="30" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td height="30" class="style31">
                                                                <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>判断题</strong>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <table width="650" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td valign="top">
                                                                <div align="left" class="style1">
                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                        <%  var type2OrderList = ExamLibHelper.GetOrderList(examInfo.Id, 2, UserHelper.LoginUser.Id,
                                                       type2Model.Count, needWash);

                                                                            for (int ii = 0; ii < type2OrderList.Count; ii++)
                                                                            {
                                                                                var item = type2Model[type2OrderList[ii]];
                                                                                var keyInfo =
                                                                                     stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);%>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <span class="style53">[<%=ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, examInfo.Score)%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                该命题是否正确?<%= Html.CheckBox("checkpan" + item.QuestionLibInfo.Id,keyInfo != null &&string.IsNullOrEmpty(keyInfo.Answer))%>
                                                                                <span class="style53">[答案][该命题<%=string.IsNullOrEmpty(item.QuestionLibInfo.QuestionAnswerInfo.Answer)?"":"不" %>正确]</span>
                                                                            </td>
                                                                        </tr>
                                                                        <% } %>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <% } %>
                                                    <% if (type3Count != 0)
                                                       {
                                                           var i = 1; %>
                                                    <table width="748" height="30" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td height="30" class="style31">
                                                                <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>论述题</strong>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <table width="650" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td valign="top">
                                                                <div align="left" class="style1">
                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                        <%  var type3OrderList = ExamLibHelper.GetOrderList(examInfo.Id, 3, UserHelper.LoginUser.Id,
                                                       type3Model.Count, needWash);

                                                                            for (int ii = 0; ii < type3OrderList.Count; ii++)
                                                                            {
                                                                                var item = type3Model[type3OrderList[ii]];
                                                                                var keyInfo =
                                                                                    stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);%>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <span class="style53">[<%=ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, examInfo.Score)%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <%= Html.TextArea(
                                                                "area" + item.QuestionLibInfo.Id,
                                                                keyInfo == null ? "" : keyInfo.Answer,
                                                                new {@class = "editArea"}) %>
                                                                            </td>
                                                                        </tr>
                                                                        <% } %>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <% } %>
                                                    <% if (type4Count != 0)
                                                       {
                                                           var i = 1; %>
                                                    <table width="748" height="30" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td height="30" class="style31">
                                                                <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>思考题</strong>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <table width="650" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td valign="top">
                                                                <div align="left" class="style1">
                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                        <%  var type4OrderList = ExamLibHelper.GetOrderList(examInfo.Id, 4, UserHelper.LoginUser.Id,
                                                       type4Model.Count, needWash);

                                                                            for (int ii = 0; ii < type4OrderList.Count; ii++)
                                                                            {
                                                                                var item = type4Model[type4OrderList[ii]];
                                                                                var keyInfo =
                                                                                    stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);%>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <span class="style53">[<%=ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, examInfo.Score)%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td class="style48">
                                                                                <%= Html.TextArea(
                                                                "area" + item.QuestionLibInfo.Id,
                                                                keyInfo == null ? "" : keyInfo.Answer,
                                                                new {@class = "editArea"}) %>
                                                                            </td>
                                                                        </tr>
                                                                        <% } %>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <% } %>
                                                    <% 
        }%>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="13" bgcolor="#FFFFFF">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="3" background="<%=ResolveUrl("~/Content/images/5_04_1.gif")%>">
                        </td>
                    </tr>
                </table>
                <table width="1000" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="10">
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
